/** @file gui_button.h
    @brief A button widget */

#ifndef G3_GUI_BUTTON_H
#define G3_GUI_BUTTON_H

#include "gui/gui_label.h"

namespace G3 {
namespace GUI {

/** @class BUTTON
    @brief A button widget class */
class BUTTON: public WIDGET {
	public:
        /**
            @brief Constructor
        */
		BUTTON ();

        /**
            @brief Destructor
        */
		virtual ~BUTTON () {
			FgVisible = false;
			BgVisible = false;
		}

        /** Background colors for different button-states */
		COL4F BgColor [3];
		/** Foreground colors for different button-states */
		COL4F FgColor [3];

        /**
            @brief Assignment operator
            @param[in] aButton Reference to the button to be copied
            @return Reference to the freshly copied button
        */
		BUTTON& operator= (const BUTTON &aButton);

        /**
            @brief Creates a button
            @param[in] aRect Reference to the button rectangle
            @param[in] aFont Pointer to the caption font
            @param[in] aCaption Reference to the caption string
        */
		void Create (const RECTI &aRect, FONT *aFont = NULL, const std::string &aCaption = "");

        /**
            @brief Sets button dimensions
            @param[in] aRect Reference to the new rectangle
        */
		void SetRect (const RECTI &aRect);

        /**
            @brief Attaches a font to the button label
            @param[in] aFont pointer to the new font
        */
		void AttachFont (FONT *aFont);

        /**
            @brief Sets the caption of the button label
            @param[in] aCaption Reference to the new caption string
        */
		void SetCaption (const string &aCaption);

        /**
            @brief Shows button foreground
        */
		void ShowForeground () { FgVisible = true; }
		/**
            @brief Shows button background
		*/
		void ShowBackground () { BgVisible = true; }
        /**
            @brief Hides button foreground
        */
		void HideForeground () { FgVisible = false; }
		/**
            @brief Hides button background
		*/
		void HideBackground () { BgVisible = false; }

        /**
            @brief Draws the button
            @param[in] aElapsedTime The elapsed time since the last call
        */
		void Draw (float aElapsedTime = 0.0f);

        /**
            @brief Gets the type of this widget
            @return The type index \see TYPE_MANAGER
        */
		virtual uint GetType () { return MainTypeMgr.GetType ("W_BUTTON"); }

        /**
            @brief Is this widget static ?
            @return False.
        */
		virtual bool IsStatic () { return false; }

    protected:
		/** Is the foreground part of the button visible ? */
		bool FgVisible;
		/** Is the background part of the button visible ? */
		bool BgVisible;
};

}
}

#endif // G3_GUI_BUTTON_H
